<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
    <h:head>
        <title>MeteoCal - User Profile</title>
	<link rel="stylesheet" type="text/css" href="${request.contextPath}/resources/css/main.css" />
    </h:head>
    <h:body>
	<p:layout fullPage="true">
	    <p:layoutUnit position="north" size="60" resizable="false" closable="false" collapsible="false">
		<ui:include src="/includes/header.xhtml"/>
            </p:layoutUnit>
	    <p:layoutUnit position="center" class="content">
		<table>
		    <tr>
			<td style="vertical-align: middle">
			    <h1><h:outputText value="#{userController.loginUser.userFirstName}"/> <nbsp/> <h:outputText value="#{userController.loginUser.userLastName}"/></h1>
			</td>
			<td style="vertical-align: middle">
			    <i><h:link outcome="/faces/user/profileUpdate.xhtml" value="Modify"/></i>
			</td>
		    </tr>
		</table>
		<div class="multi-column-container">
		    <div>
                        <h:outputText value="#{userController.loginUser.userJobTitile}"/><br/>
			<a href="mailto:#{userController.loginUser.userEmail}"><p>#{userController.loginUser.userEmail}</p></a><br/>
			<a href="${request.contextPath}/faces/user/eventList.xhtml">Event list</a><br/>
		    </div>
		    <div>
			<h:form>
			    <!--TODO: add action to button-->
			    <p:commandButton value="Suspend user" rendered="#{request.isUserInRole('admin')}" />
			</h:form>
		    </div>
		</div>
		<br/>
		<hr/>
		<br/>
		<h2 style="text-align: center;">Schedule</h2>
		<br/>
		<p:schedule id="schedule" value="#{scheduleView.getEventModel(null)}" widgetVar="myschedule" timeZone="GMT+1">
		    <p:ajax event="eventSelect" listener="#{scheduleView.onEventSelect}" />
		</p:schedule>
	    </p:layoutUnit>
	    <p:layoutUnit position="south" size="80" resizable="false" closable="false" collapsible="false">
		<ui:include src="/includes/footer.xhtml"/>
            </p:layoutUnit>
	</p:layout>
    </h:body>
</html>

